package com.house.business.controller;

import lombok.extern.slf4j.Slf4j;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.house.business.service.LeasingInformationService;
import com.house.business.entity.LeasingInformation;
import com.house.business.vo.LeasingInformationVo;
import org.springframework.web.bind.annotation.RestController;
import com.house.framework.controller.BaseController;

/**
 * <p>
 * 租赁信息表 前端控制器
 * </p>
 *
 * @since 2023-05-09
 */
@Slf4j
@RestController
@RequestMapping("/leasingInformationController")
public class LeasingInformationController extends BaseController {

    @Autowired
    private LeasingInformationService leasingInformationService;
    /**
    * 新增租赁信息表
    * @param entity
    * t_leasing_information新增数据
    * @return 新增数据id
    */
    @ApiOperation(value = "租赁信息表", notes = "新增租赁信息表")
    @RequestMapping(value = "/addLeasingInformation", method = RequestMethod.POST)
    public Object addLeasingInformation(@RequestBody LeasingInformation entity) {
        return leasingInformationService.addLeasingInformation(entity);
    }

    /**
    * 修改租赁信息表
    * @param entity
    * t_leasing_information修改数据
    * @return 修改记录数
    */
    @ApiOperation(value = "租赁信息表", notes = "修改租赁信息表")
    @RequestMapping(value = "/updateLeasingInformation", method = RequestMethod.POST)
    public Object updateLeasingInformation(@RequestBody LeasingInformation entity) {
        return leasingInformationService.updateLeasingInformation(entity);
    }

    /**
    * 取指定ID的租赁信息表数据
    * @param id
    * t_leasing_information 主键ID
    * @return 返回实体对象
    * 返回指定id 租赁信息表数据
    */
    @ApiOperation(value = "租赁信息表", notes = "取租赁信息表")
    @RequestMapping(value = "/getLeasingInformationById", method = RequestMethod.GET)
    public LeasingInformationVo getLeasingInformationById(@RequestParam Long id) {
        return leasingInformationService.getLeasingInformationById(id);
    }

    /**
    * 租赁信息表分页取数
    * @param entityVo
    * t_leasing_information 分页取数参数，pageIndex=页码；pageSize=每页记录数；
    * @return
    * 返回分页数据
    */
    @RequestMapping(value = "/getLeasingInformationList", method = RequestMethod.POST)
    public IPage<LeasingInformationVo> getLeasingInformationList(@RequestBody LeasingInformationVo entityVo){
        IPage<LeasingInformationVo> page = leasingInformationService.getLeasingInformationList(entityVo);
        return page;
    }

    /**
    * 删除指定ID的租赁信息表数据
    * @param id
    * t_leasing_information 主键ID
    */
    @ApiOperation(value = "租赁信息表", notes = "删除租赁信息表")
    @RequestMapping(value = "/deleteLeasingInformationById/{id}", method = RequestMethod.GET)
    public void deleteLeasingInformationById(@PathVariable("id") Long id) {
         leasingInformationService.deleteLeasingInformationById(id);
    }

    /**
    * 批量删除指定ID的租赁信息表数据
    * @param ids
    * t_leasing_information 主键ID
    */
    @ApiOperation(value = "租赁信息表", notes = "批量删除租赁信息表")
    @RequestMapping(value = "/batchDelete", method = RequestMethod.POST)
    public void batchDelete(@RequestParam Long[] ids) {
        leasingInformationService.batchDelete(ids);
    }

}
